<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>无标题文档</title>
		<link rel="stylesheet" href="http://127.0.0.1/vancl_php/Static/bootstrap/css/bootstrap.min.css" />
		<link rel="stylesheet" href="http://127.0.0.1/vancl_php/Static/css/hdjs.css" />
		<link href="http://127.0.0.1/vancl_php/Application/Admin/View/css/style1.css" rel="stylesheet" type="text/css" />
		<link href="http://127.0.0.1/vancl_php/Application/Admin/View/css/select.css" rel="stylesheet" type="text/css" />
		<link href="http://127.0.0.1/vancl_php/Static/css/hdjs.css" rel="stylesheet" type="text/css" />
		<style type="text/css">
			.textFn{
				float:left;
				height:32px;
				line-height: 32px;
			}
		</style>
		<script type="text/javascript" src="http://127.0.0.1/vancl_php/Static/js/jquery-1.7.2.min.js"></script>
		<script type="text/javascript" src="http://127.0.0.1/vancl_php/Static/js/hdjs.min.js"></script>
		<script type="text/javascript">
			$(function(){
				//点击修改订单状态
				//订单ID
				var oid = $('input[name=oid]').val();
				var status;
				$('input[name=order_status]').change(function(){
					status = $(this).val();
				})
				$('#editStatus').click(function(){
					if(status=='取消订单' || status=='交易完成'){
						var isedit = confirm(status+'后将无法修改');
						if(isedit){
							$.ajax({
								url:"<?php echo U('OrderList/ajaxEditStatus');?>",
								dataType:'json',
								type:'post',
								data:{oid:oid,order_status:status},
								success:function(phpData){
									hd_alert({
										message:phpData.message,
										timeout:3
									})
									$('.textFn:last').html('<span style="color:red">'+status+'</span>');
								}
						})
						}else{
							return false;
						}
					}
						$.ajax({
								url:"<?php echo U('OrderList/ajaxEditStatus');?>",
								dataType:'json',
								type:'post',
								data:{oid:oid,order_status:status},
								success:function(phpData){
								hd_alert({
									message:phpData.message,
									timeout:3
								})
								}
							})
				})
			})
		</script>
		<script type="text/javascript" src="http://127.0.0.1/vancl_php/Static/js/hdjs.min.js"></script>
		<script type="text/javascript" src="http://127.0.0.1/vancl_php/Application/Admin/View/js/jquery.idTabs.min.js"></script>
		<script type="text/javascript" src="http://127.0.0.1/vancl_php/Application/Admin/View/js/select-ui.min.js"></script>
		<script type="text/javascript" src="http://127.0.0.1/vancl_php/Static/js/cal/lhgcalendar.min.js"></script>

		<script type="text/javascript">
			$(document).ready(function(e) {
				$('#birthday').calendar({
					format: 'yyyy/MM/dd HH:mm:ss'
				});
				$(".select1").uedSelect({
					width: 345
				});
				$(".select2").uedSelect({
					width: 167
				});
//				$(".select3").uedSelect({
//					width: 100
//				});
			});
		</script>
	</head>

	<body>

		<div class="place">
			<span>位置：</span>
			<ul class="placeul">
				<li><a href="<?php echo U('Index/index');?>">首页</a>
				</li>
				<li><a href="<?php echo U('OrderList/index');?>">订单管理</a>
				</li>
				<li><a href="">订单明细</a>
				</li>
			</ul>
		</div>

		<div class="formbody">

			<div id="usual1" class="usual">

				<div class="itab">
					<ul>
						<li><a href="#tab1" class="selected">订单信息</a>
						</li>
						<li><a href="#tab2">商品列表</a>
						</li>
					</ul>
				</div>

				<div id="tab1" class="tabson">

					<input type="hidden" value="<?php echo $orderlist['oid'];?>" name="oid" />
					<ul class="forminfo">
						<li>
							<label>订单号
							</label>
							<div class="textFn"><?php echo $orderlist['order_sn'];?></div>
						</li>
						<li>
							<label>收货人
							</label>
							<div class="textFn"><?php echo $orderlist['take_man'];?></div>

						</li>
						<li>
							<label>购买帐号
							</label>
							<div class="textFn"><a href="<?php echo U('User/editUser',array('uid'=>$orderlist['users_uid']));?>"><?php echo $username;?></a>
							</div>
						</li>
						<li>
							<label>联系方式</label>
							<div class="textFn"><?php echo $orderlist['take_addr'];?></div>

						</li>
						<li>
							<label>总金额</label>
							<div class="textFn"><?php echo $orderlist['count_price'];?></div>
						</li>

						<li>
							<label>提交时间</label>
							<div class="textFn"><?php echo date('Y-m-d H:i:s',$orderlist['order_time']);?></div>
						</li>
						<li>
							<label>订单备注</label>
							<div class="textFn"><?php echo $orderlist['order_mark'];?></div>
						</li>
						<li>
							<label>订单状态</label>

							<div class="textFn">
								    <?php if($orderlist['order_status']=='取消订单' || $orderlist['order_status']=='交易完成'){ ?>
								<span style="color:red"><?php echo $orderlist['order_status'];?></span>
								<?php }else{ ?>
								<label>
									<input name="order_status" type="radio" value="未付款"     <?php if($orderlist['order_status'] == '未付款'){ ?>checked="checked"<?php } ?> />未付款</label>
								<label>
									<input name="order_status" type="radio" value="已付款"     <?php if($orderlist['order_status'] == '已付款'){ ?>checked="checked"<?php } ?> />已付款</label>
								<label>
									<input name="order_status" type="radio" value="已发货"     <?php if($orderlist['order_status'] == '已发货'){ ?>checked="checked"<?php } ?> />已发货</label>
								<label>
									<input name="order_status" type="radio" value="取消订单"     <?php if($orderlist['order_status'] == '取消订单'){ ?>checked="checked"<?php } ?> />取消订单</label>
								<label>
									<input name="order_status" type="radio" value="交易完成"     <?php if($orderlist['order_status'] == '交易完成'){ ?>checked="checked"<?php } ?> />交易完成</label>

								<a href="javascript:;" class="btn btn-primary btn-sm" id="editStatus">修改订单状态</a>
								
								<?php } ?>
							</div>

						</li>

					</ul>

				</div>

				<div id="tab2" class="tabson">
					<table class="table table-bordered table-hover">
						<tr class="active">
							<th>商品ID</th>
							<th>商品名</th>
							<th>单位</th>
							<th>颜色,尺码</th>
							<th>数量</th>
							<th>单价</th>
						</tr>
						<?php foreach ($goodslists as $kkk=>$vvv){?>
							<tr>
								<td><?php echo $vvv['gid'];?></td>
								<td><a href="<?php echo U('Index/Details/index',array('gid'=>$vvv['gid']));?>"><?php echo $vvv['goods_name'];?></a>
								</td>
								<td><?php echo $vvv['goods_unit'];?></td>
								<td><?php echo $vvv['goods_combinestr'];?></td>
								<td><?php echo $vvv['goods_num'];?></td>
								<td><?php echo $vvv['shop_price'];?>元</td>
							</tr>
						<?php }?>
						<tr class="success">
							<td colspan="6">
								合计:<?php echo $orderlist['count_price'];?>元
							</td>
						</tr>
					</table>
				</div>

			</div>

			<script type="text/javascript">
				$("#usual1 ul").idTabs();
			</script>

			<script type="text/javascript">
				$('.tablelist tbody tr:odd').addClass('odd');
			</script>

		</div>

	</body>

</html>